package com.d2rv.offscreen;

import codeanticode.glgraphics.GLGraphicsOffScreen;
import com.d2rv.camera.CameraManager;
import com.d2rv.settings.Settings;
import processing.core.PApplet;
import processing.core.PVector;

/**
 * This abstract class of the offscreen 3D
 *
 * @author Darrieutort A., Dupouy A., Rossignol L., Van Poucke A.
 */
public abstract class OffScreen3D extends GLGraphicsOffScreen {

    /**
     * Manager of the offscreen camera
     */
    protected CameraManager cameramanager;
    /**
     * State of light : true, turns on, false, turns off
     */
    protected boolean light;

    /**
     *  Default constructor.
     *
     * @param parent the current application
     * @param width the width of the offscreen
     * @param height the height of the offscreen
     * @param position the position of the offscreen
     * @param target the target of the offscreen
     * @param up the up of the offscreen
     */
    public OffScreen3D(PApplet parent, int width, int height, PVector position, PVector target, PVector up) {
        super(parent, width, height, true, Settings.getInstance().levelmutlisampling());
        this.cameramanager = new CameraManager(position, target, up);
        this.light = true;
    }

    /**
     * abstract methode to draw the offscreen 3D
     */
    public abstract void draw();

    /**
     *
     * Calls the show method the offscreen 3D
     * 
     * @param parent the current application
     * @param x the x coordinate of the left corner of the offscreen
     * @param y the y coordinate of the left corner of the offscreen
     */
    public abstract void show(PApplet parent, int x, int y);
    
    /**
     * Sets the state of the light
     * @param light 
     */
    public void light(boolean light) {
        this.light = light;
    }
    
    /**
     * Returns the state of the light
     * @return 
     */
    public boolean light() {
        return this.light;
    }
}
